/*
 * Copyright (C), 2002-2016, 上海亦寻信息技术有限公司
 * FileName: ProblemFeedbackServiceFacadeImpl.java
 * Author:   linyao
 * Date:     2016-8-11 下午2:28:19
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.emm.yixun.system.service.impl;

import javax.jws.WebService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.emm.yixun.basic.service.ProblemFeedbackService;
import com.emm.yixun.common.exception.ResponseCode;
import com.emm.yixun.common.model.dto.ProblemFeedbackDto;
import com.emm.yixun.common.page.Page;
import com.emm.yixun.common.page.PageUtil;
import com.emm.yixun.common.response.Response;
import com.emm.yixun.system.service.ProblemFeedbackServiceFacade;

/**
 * 〈一句话功能简述〉 〈功能详细描述〉
 * 
 * @author linyao
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@Service
@WebService(name = "com.emm.yixun.system.service.ProblemFeedbackServiceFacade")
public class ProblemFeedbackServiceFacadeImpl implements ProblemFeedbackServiceFacade {
	private final Logger logger = LoggerFactory.getLogger(this.getClass());
	@Autowired
	private ProblemFeedbackService problemFeedbackService;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.emm.yixun.system.service.ProblemFeedbackServiceFacade#getPageModel(com.emm.yixun.common.model.dto.
	 * ProblemFeedbackDto, int, int)
	 */
	@Override
	public Response<Page<ProblemFeedbackDto>> getPageModel(ProblemFeedbackDto entity, int begin, int end) {
		Response<Page<ProblemFeedbackDto>> response = new Response<Page<ProblemFeedbackDto>>();
		try {
			if (null == entity) {
				response.setSuccess(false);
				return response;
			}
			Page<ProblemFeedbackDto> page = problemFeedbackService.getPageDtoModel(entity, PageUtil.begin(begin, end),
					end);
			if (null == page.getRows()) {
				response.setSuccess(false);
				return response;
			}
			page.setPageSize(end);
			response.setEntity(page);
			response.setSuccess(true);
		} catch (Exception e) {
			response.setSuccess(false);
			response.setResultMessage(ResponseCode.SYSTEM_EXCEPTION.getMessageTemplate());
			logger.error("查询分页数据错误：{}", e);
		}
		return response;
	}

}
